home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / FLOAT / FPCMP.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  3KB  |  88 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAIMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Last Update 3 Nov 87   Version 2.1
  6. ;
  7. fpcmp   ident   2,1
  8. ;
  9. ; MOTOROLA DSP56000/1 FPLIB - VERSION 2
  10. ;
  11. ; FPCMP - FLOATING POINT COMPARISON (SETS CONDITION CODES) SUBROUTINE
  12. ;
  13. ;
  14. ; Entry points: fcmp_xa A - X   SET CONDITION CODES
  15. ;               fcmp_xy Y - X   SET CONDITION CODES
  16. ;
  17. ;       m = 24 bit mantissa (two's complement, normalized fraction)
  18. ;
  19. ;       e = 14 bit exponent (unsigned integer, biased by +8191)
  20. ;
  21. ; Input variables:
  22. ;
  23. ;   X   x1 = mx  (normalized)
  24. ;       x0 = ex
  25. ;
  26. ;   Y   y1 = my  (normalized)
  27. ;       y0 = ey
  28. ;
  29. ;   A   a2 = sign extension of ma
  30. ;       a1 = ma  (normalized)
  31. ;       a0 = zero
  32. ;
  33. ;       b2 = sign extension of ea (always zero)
  34. ;       b1 = ea
  35. ;       b0 = zero
  36. ;
  37. ; Output variables:
  38. ;
  39. ;       The following Jcc branch conditions can be used after calling
  40. ;       fcmp_xa or fcmp_xy.  The other branch conditions should not be used.
  41. ;
  42. ;       "cc" Mnemonic                   Condition
  43. ;       -------------                   ---------
  44. ;       EQ - equal                      Z = 1
  45. ;       GE - greater than or equal      N eor V = 0
  46. ;       GT - greater than               Z + (N eor V) = 0
  47. ;       LE - less than or equal         Z + (N eor V) = 1
  48. ;       LT - less than                  N eor V = 1
  49. ;       NE - not equal                  Z = 0
  50. ;
  51. ; Error conditions:     none
  52. ;
  53. ; Assumes n0, m0, shift constant table and scaling modes
  54. ; initialized by previous call to the subroutine "fpinit".
  55. ;
  56. ; Alters Data ALU Registers
  57. ;       a2      a1      a0      a
  58. ;       b2      b1      b0      b
  59. ;               x0              y0
  60. ;
  61. ; Alters Address Registers
  62. ;
  63. ;
  64. ; Alters Program Control Registers
  65. ;       pc      sr
  66. ;
  67. ; Uses 0 locations on System Stack
  68. ;
  69. ;
  70. fcmp_xy tfr     y0,b    y1,a            ;get ey, my
  71. fcmp_xa eor     x1,a    a,y0            ;compare signs, save ma
  72.         jmi     _mant                   ;jump if different signs
  73. ;
  74. ; Same signs
  75. ;
  76. _sign   eor     x1,a                    ;check sign of ma
  77.         jpl     _sign1                  ;jump if ma and mx positive
  78.         tfr     x0,b    b,x0            ;if minus, exchange ea and ex
  79. _sign1  cmp     x0,b                    ;compare exponents
  80.         jne     done                    ;jump if different exponents
  81. ;
  82. ; Same signs, same exponents or different signs
  83. ;
  84. _mant   tfr     y0,a                    ;restore ma
  85.         cmp     x1,a                    ;compare mantissa
  86.         rts
  87.